package com.bianmaba.netty.server;

import com.bianmaba.netty.server.server.BootNettyServer;
import lombok.extern.log4j.Log4j2;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.WebApplicationType;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.EnableAsync;

@SpringBootApplication
@Log4j2
@EnableAsync
public class ServerMainApplication implements CommandLineRunner {
    public static void main(String[] args) {
        SpringApplication app = new SpringApplication(ServerMainApplication.class);
        app.setWebApplicationType(WebApplicationType.NONE);//不启动web服务
        app.run(args);

        log.info("springboot启动");
    }

    @Async
    @Override
    public void run(String... args) throws Exception {
        /**
         * 使用异步注解方式启动netty服务端服务
         */
         new BootNettyServer().bind(8888);

    }

}
